package com.gitee.srurl.snow.backwards;

import com.gitee.srurl.snow.domain.SnowflakeData;
import lombok.extern.slf4j.Slf4j;

/**
 * 拒绝时钟回拨
 *
 * @author zxw
 * @date 2023/4/22 11:29
 */
@Slf4j
public class RejectClockBackwards extends AbstractBackwards {

    public RejectClockBackwards(long lastTimestamp, SnowflakeData snowflakeData) {
        super(lastTimestamp, snowflakeData);
    }

    @Override
    public long nextId() {
        log.error("时钟回拨，执行拒绝生成ID策略");
        throw new IllegalStateException("时钟回拨，拒绝生成新ID");
    }

    @Override
    public long getLastTimestamp() {

        return -1;
    }
}
